package Test;

public class Rectangle implements Calculability {
    private int length;
    private int width;
    /**
     * 无参数构造器
     * 默认：长5 宽4
     */
    public Rectangle(){
        length=5;
        width=4;
    }
    /**
     *
     * @param l 长
     * @param w 宽
     */
    public Rectangle(int l,int w){
        this.length=l;
        this.width=w;
    }

    /**
     * FOR TEST
     * @param args No args
     */
    public static void main(String[] args) {
        Rectangle rectangle=new Rectangle();
        System.out.println("长方形：长："+rectangle.getLength()+" 宽: "+rectangle.getWidth());
        System.out.println("面积为： "+rectangle.area());
    }

    @Override
    public int area(){
        return length*width;
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }
}
